<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>药品采购</title>
</head>
<body>
	<script>
		$(function() {

			//老药品添加
			$('#cancel-oldpurchase').click(function() {
				$('#oldpurchase-win').window("open");
				var ggys = $("#gongys").textbox("getValue");
				var summ = $("#purchase-dg").datagrid('getRows');
				if(summ.length==0){
					//老药品选择供应商
					$('#gys-state').combobox({ disabled: false });
					$('#gys-state').combobox({   
						url:'all-supplier',//数据源
			         	valueField: 'supplier_number',//数据库名字---主键id
				        textField: 'supplier_name',//需要显示在下拉框的实际内容
				        editable:false,
			            panelHeight:'auto',//高度根据内容自动定
			            onChange: function () {
							var category = $("#gys-state").combobox("getValue");
							$('#oldpurchase-dg').datagrid({
								url : 'find-supplier',
								pagination : true,
								queryParams : {
									supplierno : category
								},
								method:"Post",
								pageNumber : 1,
								pageSize : 10,
								pageList : [ 10, 20 ],
								columns : [ [ 
									{field : 'code',					title : '编号',			width : 40,checkbox:true}, 
									{field : 'drug_number',				title : '药品编号',		width : 173.3}, 
									{field : 'drug_name',				title : '药品名称',		width : 184.3}, 
									{field : 'drug_standard',			title : '规格',			width : 153.3}, 
									{field : 'drug_unit',				title : '单位',			width : 153.3}, 
									{field : 'supplier_number',			title : '供应商id',		width : 180,hidden:true}, 
									{field : 'drug_purchase_price',		title : '单价',			width : 173.3}, 
									{field : 'inventory_quantity',		title : '库存数量',		width : 173.3}
								] ]
							});
						},
			            onLoadSuccess: function () {  //加载完成后,设置选中第一项
			                    var val = $(this).combobox("getData");
								//初始化数据默认选中第一个
								$(this).combobox("setValue", val[0].supplier_number);
			            }
						
		 			});	
				}else{  
					$('#gys-state').combobox("setValue",ggys);
					$('#gys-state').combobox('disable');
					
					//老药品选择供应商
					$('#oldpurchase-dg').datagrid({
						url : 'find-supplier',
						pagination : true,
						queryParams : {
							supplierno : ggys
						},
						method:"Post",
						pageNumber : 1,
						pageSize : 10,
						pageList : [ 10, 20 ],
						columns : [ [ 
							{field : 'code',					title : '编号',			width : 40,checkbox:true}, 
							{field : 'drug_number',				title : '药品编号',		width : 173.3}, 
							{field : 'drug_name',				title : '药品名称',		width : 184.3}, 
							{field : 'drug_standard',			title : '规格',			width : 153.3}, 
							{field : 'drug_unit',				title : '单位',			width : 153.3}, 
							{field : 'supplier_number',			title : '供应商id',		width : 180,hidden:true}, 
							{field : 'drug_purchase_price',		title : '单价',			width : 173.3}, 
							{field : 'inventory_quantity',		title : '库存数量',		width : 173.3}
						] ]
					});
				}	
				
				
				
			})
			
			//药品退药
			$('#checkdrug-ann').click(function() {
				
				$('#tuidrug-win').window("open");
				
				var ggty = $("#gongty").textbox("getValue");
				var sumty = $("#returnwin").datagrid('getRows');
				if(sumty.length==0){
					//药品选择供应商
					$('#bingbox').combobox({ disabled: false });
					$('#bingbox').combobox({   
						url:'all-supplier',//数据源
			         	valueField: 'supplier_number',//数据库名字---主键id
				        textField: 'supplier_name',//需要显示在下拉框的实际内容
				        editable:false,
			            panelHeight:'auto',//高度根据内容自动定
			            onChange: function () {
							var category = $("#bingbox").combobox("getValue");
							$('#returndrug').datagrid({
								url : 'select-drugs',
								pagination : true,
								queryParams : {
									supplierno : category
								},
								method:"Post",
								pageNumber : 1,
								pageSize : 10,
								pageList : [ 10, 20 ],
								columns : [ [ 
									{field : 'code',							title : '编号',				width : 40,checkbox:true}, 
									{field : 'inventory_number',				title : '库存编号',			width : 160,hidden:true}, 
									{field : 'inventory_details_number',		title : '药品库存编号',		width : 150}, 
									{field : 'drug_name',						title : '药品名称',			width : 160}, 
									{field : 'drug_standard',					title : '规格',				width : 150}, 
									{field : 'inventory_details_usedate',		title : '有效期',				width : 153,formatter:comFormatDate}, 
									{field : 'drug_purchase_price',				title : '单价',				width : 130}, 
									{field : 'inventory_details_batch',			title : '批次',				width : 115} ,
									{field : 'inventory_details_quantity',		title : '库存数量',			width : 151}
								] ]
							});
						},
			            onLoadSuccess: function () {  //加载完成后,设置选中第一项
			                    var val = $(this).combobox("getData");
								//初始化数据默认选中第一个
								$(this).combobox("setValue", val[0].supplier_number);
			            }
						
		 			});	
				}else{
					$('#bingbox').combobox("setValue",ggty);
					$('#bingbox').combobox('disable');
					
					//药品选择供应商
					$('#returndrug').datagrid({
						url : 'select-drugs',
						pagination : true,
						queryParams : {
							supplierno : ggty
						},
						method:"Post",
						pageNumber : 1,
						pageSize : 10,
						pageList : [ 10, 20 ],
						columns : [ [ 
							{field : 'code',							title : '编号',				width : 40,checkbox:true}, 
							{field : 'inventory_number',				title : '库存编号',			width : 160,hidden:true}, 
							{field : 'inventory_details_number',		title : '药品库存编号',		width : 150}, 
							{field : 'drug_name',						title : '药品名称',			width : 160}, 
							{field : 'drug_standard',					title : '规格',				width : 150}, 
							{field : 'inventory_details_usedate',		title : '有效期',				width : 153,formatter:comFormatDate}, 
							{field : 'drug_purchase_price',				title : '单价',				width : 130}, 
							{field : 'inventory_details_batch',			title : '批次',				width : 115} ,
							{field : 'inventory_details_quantity',		title : '库存数量',			width : 151}
						] ]
					});
					
				}
				
				
				
				
			})
			
			//药品销毁
			$('#destruction-ann').click(function() {
				
				$('#destruction-win').window("open");

				$('#destruction-drug').datagrid({
					url : 'select-drugs',
					pagination : true,
					method:"Post",
					pageNumber : 1,
					pageSize : 10,
					pageList : [ 10, 20 ],
					columns : [ [ 
						{field : 'code',							title : '编号',				width : 40,checkbox:true}, 
						{field : 'inventory_number',				title : '库存编号',			width : 160,hidden:true}, 
						{field : 'inventory_details_number',		title : '药品库存编号',		width : 150}, 
						{field : 'drug_name',						title : '药品名称',			width : 160}, 
						{field : 'drug_standard',					title : '规格',				width : 150}, 
						{field : 'inventory_details_usedate',		title : '有效期',				width : 153,formatter:comFormatDate}, 
						{field : 'drug_purchase_price',				title : '单价',				width : 130}, 
						{field : 'inventory_details_batch',			title : '批次',				width : 115} ,
						{field : 'inventory_details_quantity',		title : '库存数量',			width : 151}
					] ]
				});
								
				
			})

			//新药品添加
			$('#cancel-newpurchase').click(function() {
				$('#newpurchase-win').window("open");
			})

			//采购界面
			$('#purchase-dg').datagrid({
				url : '',
				pagination : true,
				pageNumber : 1,
				rownumbers:true,
				pageSize : 10,
				singleSelect: true,
				pageList : [ 10, 20 ],
				columns : [ [ 
					{field : 'drug_number',					title : '药品编号',		width : 190}, 
					{field : 'drug_name',					title : '药品名称',		width : 190}, 
					{field : 'drug_standard',				title : '规格',			width : 190}, 
					{field : 'drug_unit',					title : '单位',			width : 93}, 
					{field : 'drug_purchase_price',			title : '单价',			width : 180}, 
					{field : 'supplier_number',				title : '供应商id',		width : 180,hidden:true}, 
					{field : 'indent_details_quantity',		title : '采购数量',		width : 175,editor:'numberbox'}
				] ]
			});

			
			
			
			
			//采购点击老药品添加按钮
			$("#save-oldpurchase").click(function(){
				//获取表格中的信息
				var rows =$("#oldpurchase-dg").datagrid('getSelections');
				var copyRows = [];
	            for (var j= 0; j < rows.length; j++) {
	                copyRows.push(rows[j]); //将数据添加到copyRows数组中     
	            }
	            for(var i =0;i<copyRows.length;i++){ 
					var falg = true;
					var index = $('#oldpurchase-dg').datagrid('getRowIndex',copyRows[i]);
					//获取追加的表格的行
					var recordrows = $("#purchase-dg").datagrid("getRows");
					for(var m=0;m<recordrows.length;m++){
					     //判断该datagrid在将要添加的数据中是否存在
					     if(copyRows[i].drug_number == recordrows[m].drug_number){					      
					        	falg = false;
					     }
					} 
	                 if(falg){
	                	 $("#purchase-dg").datagrid('appendRow',{
	                		 drug_number:rows[i].drug_number,
	                		 drug_name:rows[i].drug_name,
	                		 drug_standard:rows[i].drug_standard,
	                		 drug_unit:rows[i].drug_unit,
	                		 supplier_number :rows[i].supplier_number,
	                		 drug_purchase_price:rows[i].drug_purchase_price
		 		         });
	                 }	                
	            }
	            
	            var gys = $("#gys-state").combobox("getValue");
	            $("#gongys").textbox('setValue',gys);
	            
	            //清除所有所选的项
		        $("#oldpurchase-dg").datagrid('clearChecked');	
		        $('#oldpurchase-win').window("close");
			});
			
			//清空显示药品信息表格的按钮
			$("#delete-purchase").click(function(){
	            //获取datalist中所有被选中的数据
	            var record_rows = $("#purchase-dg").datalist('getChecked');
	            if(record_rows==null){
	            	alert("请选择一行");
	            }           
	            if (record_rows.length > 0){
	                var rowsLength = record_rows.length;
	                //删除所有选中的行
	                for (var i = 0; i < rowsLength; i++){
	                    var checkedRow = record_rows[i];            
	                    var checkedRowIndex = $("#purchase-dg").datalist('getRowIndex', checkedRow);
	                    $("#purchase-dg").datalist('deleteRow', checkedRowIndex);                
	                }
	            }
	
			});
			
			//采购清空
			$("#delete-kong").click(function(){
				//清除所有的项
				$("#purchase-dg").datagrid("loadData", {total:0, rows:[]});
			});
			
			//药品采购
			$("#save-purchase").click(function(){
				 var rowss = $("#purchase-dg").datagrid("getRows");
				 var panduan =true; 
				 var qwe=true;
				 var ppp=false;
				 //判断是否有药品
				 if(rowss==""){	
				 	$(".drugonef").text("请选择药品");
					$("#DRUGONEf").window('open');						
			    	//两秒之后自动消失
				   	setTimeout(function(){
						$("#DRUGONEf").window('close');
						
					}, 2000);
				   	ppp=true;
				 }
				 //判断是否填写数量
				 if(ppp==false){
					 for(var i=0;i<rowss.length;i++){
							 var shd = parseInt(rowss[i]["indent_details_quantity"]);
							 if(isNaN(shd)){
								 panduan = false ;
							 }
							 if(shd<=0){
								 qwe=false;
							 }
					 }	
					 if(panduan==false){
							$(".drugone").text("请填写数量");
							$("#DRUGONE").window('open');						
					    	//两秒之后自动消失
						   	setTimeout(function(){
								$("#DRUGONE").window('close');
								
							}, 2000);
							
					 }else if(qwe==false){
						 	$(".drugone").text("数量不能小于零");
							$("#DRUGONE").window('open');						
					    	//两秒之后自动消失
						   	setTimeout(function(){
								$("#DRUGONE").window('close');
								
							}, 2000);
					 }else{
						 caigou();					
					 } 
				 }
				
				 
				
			});
			
			//采购
			function caigou(){
				$("<form method='post' id='for'>").appendTo("body").form({
					url:'save-Bydrug',
					onSubmit:function(param){
						var shijan = CurentTime();
						//获取采购状态
						param["Indent.indentState"] = 0;

						//获取开始时间，结束时间(--注意：这里要用时间的转换器--)
						param["Indent.indentTime"] = shijan;	
						
						//获取供应商id
						param["Indent.supplier.supplierNumber"] = $("#gongys").val();	
						
						//获取负责人
						param["Indent.indentPeople"] =$("#indentPeople").val() ;	
						
						//获取表格中的采购的详情记录
						var rows = $("#purchase-dg").datagrid("getRows");

						var total=0;
						var money=0;
						for (var i = 0; i < rows.length; i++) {
							//药品编号
							param["IndentDetail["+i+"].drug.drugNumber"] = rows[i]["drug_number"];
							//单个药品的采购数量                                                          
							param["IndentDetail["+i+"].indentDetailsQuantity"] = rows[i]["indent_details_quantity"]; 
							//药品的总数量
							total +=parseInt(rows[i]["indent_details_quantity"]); 
							//药品的总金额
							money+=rows[i]["drug_purchase_price"]*parseInt(rows[i]["indent_details_quantity"]);
						}
						//总数量
						param["Indent.indentAllquantity"] = parseInt(total);
						//总金额
						param["Indent.indentAllmoney"] = money;
					},
					success:function(data){
						 if(parseInt(data)==1){
								$(".drugone").text("采购成功！！！");
								$("#DRUGONE").window('open');						
								$("#purchase-dg").datagrid("loadData", {total:0, rows:[]});
						    	//三秒之后自动消失
							   	setTimeout(function(){
									$("#DRUGONE").window('close');
									
								}, 2000);
					    	
							    $('#for').form("clear");//清空文本
						}
							
						if(parseInt(data)==2){
						    $(".drugone").text("采购失败,稍后重试......");
						    $("#purchase-dg").datagrid("loadData", {total:0, rows:[]});
						  	$("#DRUGONE").window('open');
						   	//三秒之后自动消失
						   	setTimeout(function(){
						    	 $("#DRUGONE").window('close');
							}, 2000);
							
						}
						
					}
				}).submit();
			}
			
			
			//退药界面
			$('#returnwin').datagrid({
				url : '',
				pagination : true,
				pageNumber : 1,
				pageSize : 10,
				singleSelect: true,
				rownumbers:true,
				pageList : [ 10, 20 ],
				columns : [ [ 
					{field : 'inventory_number',				title : '库存编号',			width : 150,hidden:true}, 
					{field : 'inventory_details_number',		title : '药品库存编号',		width : 150}, 
					{field : 'drug_name',						title : '药品名称',			width : 150}, 
					{field : 'drug_standard',					title : '规格',				width : 120}, 
					{field : 'drug_unit',						title : '单位',				width : 98}, 
					{field : 'drug_purchase_price',				title : '单价',				width : 110}, 
					{field : 'inventory_details_batch',			title : '批次',				width : 100} ,
					{field : 'inventory_details_quantity',		title : '库存数量',			width : 145}, 
					{field : 'return_details_quantity',			title : '退货数量',			width : 145, editor:'numberbox'}
				] ]
			});
			

			//退药点击药品添加按钮
			$("#save-tuidrug").click(function(){
				//获取表格中的信息
				var rows =$("#returndrug").datagrid('getSelections');
				var copyRows = [];
	            for (var j= 0; j < rows.length; j++) {
	                copyRows.push(rows[j]); //将数据添加到copyRows数组中     
	            }
	            for(var i =0;i<copyRows.length;i++){ 
					var falg = true;
					var index = $('#returndrug').datagrid('getRowIndex',copyRows[i]);
					//获取追加的表格的行
					var recordrows = $("#returnwin").datagrid("getRows");
					for(var m=0;m<recordrows.length;m++){
					     //判断该datagrid在将要添加的数据中是否存在
					     if(copyRows[i].inventory_details_number == recordrows[m].inventory_details_number){					      
					        	falg = false;
					     }
					} 
	                 if(falg){
	                	 $("#returnwin").datagrid('appendRow',{
	                		 inventory_number:rows[i].inventory_number,
	                		 inventory_details_number:rows[i].inventory_details_number,
	                		 drug_name:rows[i].drug_name,
	                		 drug_standard:rows[i].drug_standard,
	                		 drug_unit:rows[i].drug_purchase_price,
	                		 drug_purchase_price:rows[i].drug_purchase_price,
	                		 inventory_details_batch:rows[i].inventory_details_batch,
	                		 inventory_details_quantity:rows[i].inventory_details_quantity,
	                		 return_details_quantity:rows[i].inventory_details_quantity
		 		         });
	                 }	                
	            }
	            
	            var gyty = $("#bingbox").combobox("getValue");
	            $("#gongty").textbox('setValue',gyty);
	            
	            //清除所有所选的项
		        $("#returndrug").datagrid('clearChecked');	
		        $('#tuidrug-win').window("close");
			});
			
			//清空显示药品信息表格的按钮
			$("#deletedrug-ann").click(function(){
	            //获取datalist中所有被选中的数据
	            var record_rows = $("#returnwin").datalist('getChecked');
	            if(record_rows==null){
	            	alert("请选择一行");
	            }           
	            if (record_rows.length > 0){
	                var rowsLength = record_rows.length;
	                //删除所有选中的行
	                for (var i = 0; i < rowsLength; i++){
	                    var checkedRow = record_rows[i];            
	                    var checkedRowIndex = $("#returnwin").datalist('getRowIndex', checkedRow);
	                    $("#returnwin").datalist('deleteRow', checkedRowIndex);                
	                }
	            }
	
			});
			
			//清空退药
			$("#delete-qkong").click(function(){
				//清除所有的项
				$("#returnwin").datagrid("loadData", {total:0, rows:[]});
			});
			

			// 时间戳
			function CurentTime(){
		  
		        var now = new Date();
		       
		        var year = now.getFullYear();       //年
		        var month = now.getMonth() + 1;     //月
		        var day = now.getDate();            //日
		       
		        var hh = now.getHours();            //时
		        var mm = now.getMinutes();          //分
				var ss = now.getSeconds();			//秒
		       
		        var clock = year + "-";
		       
		        if(month < 10)
		            clock += "0";
		       
		        clock += month + "-";
		       
		        if(day < 10)
		            clock += "0";
		           
		        clock += day + " ";
		       
		        if(hh < 10)
		            clock += "0";
		           
		        clock += hh + ":";
		        if (mm < 10) clock += '0'; 
		        clock += mm + ":"; 
				
		        if (ss < 10) clock += '0'; 
		        clock += ss; 
		        return(clock); 
			}
			

			//标准时间变成时间戳
			function dateToms(date){
			 	var timestamp2 = Date.parse(new Date(date));
			    return timestamp2;
			}
			
			//时间戳变成yyyy
			function formatDateTime(inputTime) {    
			        var date = new Date(inputTime);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
			        Y = date.getFullYear() + '-';
			        M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
			        D = date.getDate() + ' ';
			        h = date.getHours() + ':';
			        m = date.getMinutes() + ':';
			        s = date.getSeconds();
			        return Y+M+D+h+m+s;
	  
			};

			//药品退药
			$("#que-returndrug").click(function(){
				//获取退药原因
				var tts = $("#returndrug-jiek").val() ;
				//获取表格数据
				var low = $("#returnwin").datagrid("getRows");
				
				var panduan = true;
				var asd = true;
				var qwe = true;
				var qwer = true;
				
				if(tts==""){
					panduan = false ;
				}
				
				//判断是否有药品
				if(low==""){	
				 	$(".drugone").text("请选择药品");
					$("#DRUGONE").window('open');						
			    	//两秒之后自动消失
				   	setTimeout(function(){
						$("#DRUGONE").window('close');
						
					}, 2000);
				   	asd=false;
				}
				//判断是否填写数量
				if(asd==true){
					 for(var i=0;i<low.length;i++){
							 var shd = parseInt(low[i]["return_details_quantity"]);
							 var dsh = parseInt(low[i]["inventory_details_quantity"]);
							 if(dsh<shd){
								 qwer = false ;
							 }
							 if(shd<=0){
								 qwe=false;
							 }
					 }	
					 if(qwer==false){
							$(".drugone").text("退药数量不能大于库存数量");
							$("#DRUGONE").window('open');						
					    	//两秒之后自动消失
						   	setTimeout(function(){
								$("#DRUGONE").window('close');
								
							}, 2000);
							
					 }else if(qwe==false){
						 	$(".drugone").text("数量不能小于零");
							$("#DRUGONE").window('open');						
					    	//两秒之后自动消失
						   	setTimeout(function(){
								$("#DRUGONE").window('close');
								
							}, 2000);
					 }else if(panduan==false){
							$(".drugone").text("请填写退药原因！！！");
							$("#DRUGONE").window('open');						
					    	//三秒之后自动消失
						   	setTimeout(function(){
								$("#DRUGONE").window('close');
								
							}, 1500);
							
					 }else{
						 	tuiyao();					
					 } 
				}

			});
			
			function tuiyao(){
				$("<form method='post' id='for'>").appendTo("body").form({
					url:'save-Return',				
					onSubmit:function(param){

						//获取退药状态
						param["good.indentState"] = 0;

						var shijan = CurentTime();
						//获取开始时间，结束时间(--注意：这里要用时间的转换器--)
						param["good.returnGoodsTime"] = shijan ;

						//获取供应商id
						param["good.supplier.supplierNumber"] = $("#gongty").val();	
						
						//获取负责人
						param["good.returnGoodsHead"] =$("#indentPeople").val() ;	
						
						//获取退药原因
						param["good.returnGoodsReason"] =$("#returndrug-jiek").val() ;	
						
						//获取表格中的详情记录
						var rows = $("#returnwin").datagrid("getRows");
						console.log(rows);

						var total=0;
						var money=0;
						for (var i = 0; i < rows.length; i++) {
							//药品库存编号
							param["gooddetail["+i+"].inventory.inventoryNumber"] = rows[i]["inventory_number"];
							//单个药品的退药数量                                                          
							param["gooddetail["+i+"].returnDetailsQuantity"] = rows[i]["return_details_quantity"]; 
							//药品批次
							param["gooddetail["+i+"].returnDetailsPici"] = rows[i]["inventory_details_batch"];
							//药品的总数量
							total +=parseInt(rows[i]["return_details_quantity"]); 
							//药品的总金额
							money+=rows[i]["drug_purchase_price"]*rows[i]["return_details_quantity"];
							
						}
						console.log(money);
						//总数量
						param["good.returnGoodsAllquantity"] = parseInt(total);
						//总金额
						param["good.returnGoodsTotal"] = money;
					},
					success:function(data){
						 if(parseInt(data)==1){
								$(".drugone").text("退药申请成功！！！");
								$("#returnwin").datagrid("loadData", {total:0, rows:[]});						  	
							 	$("#DRUGONE").window('open');
							  	$('#returndrug-jiek').textbox("clear");
						    	//三秒之后自动消失
							   	setTimeout(function(){
									$("#DRUGONE").window('close');
									
								}, 2000);
					    	
							    $('#for').form("clear");//清空文本
						}
							
						if(parseInt(data)==2){
						    $(".drugone").text("退药失败,稍后重试......");
						 	 //清空文本
							$("#returnwin").datagrid("loadData", {total:0, rows:[]});						  	
						 	$("#DRUGONE").window('open');
						  	$('#returndrug-jiek').textbox("clear");
						   	//三秒之后自动消失
						   	setTimeout(function(){
						    	 $("#DRUGONE").window('close');
							}, 2000);
							
						}
						
					}
				}).submit();
			}
			
			//药品销毁界面
			$('#destructionwin').datagrid({
				url : '',
				pagination : true,
				pageNumber : 1,
				pageSize : 10,
				singleSelect: true,
				rownumbers:true,
				pageList : [ 10, 20 ],
				columns : [ [ 
					{field : 'inventory_number',				title : '库存编号',				width : 131,hidden:true}, 
					{field : 'inventory_details_number',		title : '药品库存编号',			width : 160}, 
					{field : 'drug_name',						title : '药品名称',				width : 156}, 
					{field : 'drug_standard',					title : '规格',					width : 150}, 
					{field : 'drug_unit',						title : '单位',					width : 110}, 
					{field : 'inventory_details_batch',			title : '批次',					width : 140},
					{field : 'inventory_details_quantity',		title : '库存数量',				width : 150},
					{field : 'inventory_de_quantity',			title : '销毁数量',				width : 150, editor:'numberbox'}
				] ]
			});
			
			
			//销毁点击药品添加按钮
			$("#save-destruction").click(function(){
				//获取表格中的信息
				var rows =$("#destruction-drug").datagrid('getSelections');
				var copyRows = [];
	            for (var j= 0; j < rows.length; j++) {
	                copyRows.push(rows[j]); //将数据添加到copyRows数组中     
	            }
	            for(var i =0;i<copyRows.length;i++){ 
					var falg = true;
					var index = $('#destruction-drug').datagrid('getRowIndex',copyRows[i]);
					//获取追加的表格的行
					var recordrows = $("#destructionwin").datagrid("getRows");
					for(var m=0;m<recordrows.length;m++){
					     //判断该datagrid在将要添加的数据中是否存在
					     if(copyRows[i].inventory_details_number == recordrows[m].inventory_details_number){					      
					        	falg = false;
					     }
					} 
	                 if(falg){
	                	 $("#destructionwin").datagrid('appendRow',{
	                		 inventory_number:rows[i].inventory_number,
	                		 inventory_details_number:rows[i].inventory_details_number,
	                		 drug_name:rows[i].drug_name,
	                		 drug_standard:rows[i].drug_standard,
	                		 drug_unit:rows[i].drug_unit,
	                		 inventory_details_batch:rows[i].inventory_details_batch,
	                		 inventory_details_quantity:rows[i].inventory_details_quantity,
	                		 inventory_de_quantity :rows[i].inventory_details_quantity
		 		         });
	                 }	                
	            }
;
	            
	            //清除所有所选的项
		        $("#destruction-drug").datagrid('clearChecked');	
		        $("#destruction-win").window("close");
		        
			});
			
			//清空显示药品信息表格的按钮
			$("#destructiondele").click(function(){
	            //获取datalist中所有被选中的数据
	            var record_rows = $("#destructionwin").datalist('getChecked');
	            if(record_rows==null){
	            	alert("请选择一行");
	            }           
	            if (record_rows.length > 0){
	                var rowsLength = record_rows.length;
	                //删除所有选中的行
	                for (var i = 0; i < rowsLength; i++){
	                    var checkedRow = record_rows[i];            
	                    var checkedRowIndex = $("#destructionwin").datalist('getRowIndex', checkedRow);
	                    $("#destructionwin").datalist('deleteRow', checkedRowIndex);                
	                }
	            }
	
			});
			
			//清空销毁
			$("#delete-qkonga").click(function(){
				//清除所有的项
				$("#destructionwin").datagrid("loadData", {total:0, rows:[]});
			});
			
			//药品销毁
			$("#destruc-drug").click(function(){
				var ttt = $("#destruction-ysy").val() ;
				//获取表格数据
				var low = $("#destructionwin").datagrid("getRows");
				
				var panduan = true;
				var asd = true;
				var qwe = true;
				var qwer = true;
				
				if(ttt==""){
					panduan = false ;
				}
				
				//判断是否有药品
				if(low==""){	
				 	$(".drugone").text("请选择药品");
					$("#DRUGONE").window('open');						
			    	//两秒之后自动消失
				   	setTimeout(function(){
						$("#DRUGONE").window('close');
						
					}, 2000);
				   	asd=false;
				}
				//判断是否填写数量
				if(asd==true){
					 for(var i=0;i<low.length;i++){
							 var shd = parseInt(low[i]["inventory_de_quantity"]);
							 var dsh = parseInt(low[i]["inventory_details_quantity"]);
							 if(dsh<shd){
								 qwer = false ;
							 }
							 if(shd<=0){
								 qwe=false;
							 }
					 }	
					 if(qwer==false){
							$(".drugone").text("销毁数量不能大于库存数量");
							$("#DRUGONE").window('open');						
					    	//两秒之后自动消失
						   	setTimeout(function(){
								$("#DRUGONE").window('close');
								
							}, 2000);
							
					 }else if(qwe==false){
						 	$(".drugone").text("数量不能小于零");
							$("#DRUGONE").window('open');						
					    	//两秒之后自动消失
						   	setTimeout(function(){
								$("#DRUGONE").window('close');
								
							}, 2000);
					 }else if(panduan==false){
							$(".drugone").text("请填写销毁原因！！！");
							$("#DRUGONE").window('open');						
					    	//三秒之后自动消失
						   	setTimeout(function(){
								$("#DRUGONE").window('close');
								
							}, 1500);
							
					 }else{
						 xiaohui();					
					 } 
				}
			});
			
			function xiaohui(){
				$("<form method='post' id='for'>").appendTo("body").form({
					url:'save-Destruction',				
					onSubmit:function(param){

						//获取销毁状态
						param["destroy.destroyState"] = 0;

						var shijan = CurentTime();
						//获取开始时间，结束时间(--注意：这里要用时间的转换器--)
						param["destroy.destroyTime"] = shijan;
						
						//获取负责人
						param["destroy.destroyHead"] =$("#indentPeople").val() ;	
						
						//获取退药原因
						param["destroy.destroyReason"] =$("#destruction-ysy").val() ;	
						
						//获取表格中的详情记录
						var rows = $("#destructionwin").datagrid("getRows");
						console.log(rows);

						var total=0;
						var money=0;
						for (var i = 0; i < rows.length; i++) {
							//药品库存编号
							param["destrydetail["+i+"].inventory.inventoryNumber"] = rows[i]["inventory_number"];
							//单个药品的退药数量                                                          
							param["destrydetail["+i+"].destroyDetailsQuantity"] = rows[i]["inventory_de_quantity"]; 
							//药品批次
							param["destrydetail["+i+"].destroyPiCi"] = rows[i]["inventory_details_batch"];
							//药品的总数量
							total +=parseInt(rows[i]["inventory_de_quantity"]);
							//药品的总金额
							money+=rows[i]["drug_purchase_price"]*rows[i]["inventory_de_quantity"];   
							
						}
						//总数量
						param["destroy.destroyAllquantity"] = parseInt(total);;
					},
					success:function(data){
						if(parseInt(data)==1){
							$(".drugone").text("销毁申请成功！！！");
							$('#destruction-ysy').textbox("clear");//清空文本
							$("#destructionwin").datagrid("loadData", {total:0, rows:[]});					  	
						 	$("#DRUGONE").window('open');
					    	//三秒之后自动消失
						   	setTimeout(function(){
								$("#DRUGONE").window('close');
								
							}, 2000);
				    	
						    $('#for').form("clear");//清空文本
						}
							
						if(parseInt(data)==2){
						    $(".drugone").text("销毁申请失败,稍后重试......");
						 	 //清空文本
							$('#destruction-ysy').textbox("clear");//清空文本
							$("#destructionwin").datagrid("loadData", {total:0, rows:[]});	  	
						 	$("#DRUGONE").window('open');
						   	//三秒之后自动消失
						   	setTimeout(function(){
						    	 $("#DRUGONE").window('close');
							}, 2000);
							
						}
						
					}
				}).submit();
			}
			
			//临近三个月
			$(".hosTMonth").click(function(){
				var Tdays = $("#bingbox").combobox('getValue');
	    	 	var days=90;
		 		$("#returndrug").datagrid({
				    url:'select-drugs',
				    pagination:true,
				    pageNumber:1,
				    pageSize:10,
				    pageList:[10,20],
				    queryParams : {
						supplierno : Tdays,
						days : days
					},
				    columns : [ [ 
						{field : 'code',							title : '编号',				width : 40,checkbox:true}, 
						{field : 'inventory_number',				title : '库存编号',			width : 160,hidden:true}, 
						{field : 'inventory_details_number',		title : '药品库存编号',		width : 150}, 
						{field : 'drug_name',						title : '药品名称',			width : 160}, 
						{field : 'drug_standard',					title : '规格',				width : 150}, 
						{field : 'inventory_details_usedate',		title : '有效期',			width : 153,formatter:comFormatDate}, 
						{field : 'drug_purchase_price',				title : '单价',				width : 130}, 
						{field : 'inventory_details_batch',			title : '批次',				width : 115} ,
						{field : 'inventory_details_quantity',		title : '库存数量',			width : 151}
					] ]
				});
		   });
	   
		   //临近一个月
		   $(".hosOMonth").click(function(){
			   	var Tdays = $("#bingbox").combobox('getValue');
		    	var days=30;
		 		$("#returndrug").datagrid({
				    url:'select-drugs',
				    pagination:true,
				    pageNumber:1,
				    pageSize:10,
				    pageList:[10,20],
				    queryParams : {
						supplierno : Tdays,
						days : days
					},
				    columns : [ [ 
				    	{field : 'code',							title : '编号',				width : 40,checkbox:true}, 
						{field : 'inventory_number',				title : '库存编号',			width : 160,hidden:true}, 
						{field : 'inventory_details_number',		title : '药品库存编号',		width : 150}, 
						{field : 'drug_name',						title : '药品名称',			width : 160}, 
						{field : 'drug_standard',					title : '规格',				width : 150}, 
						{field : 'inventory_details_usedate',		title : '有效期',			width : 153,formatter:comFormatDate}, 
						{field : 'drug_purchase_price',				title : '单价',				width : 130}, 
						{field : 'inventory_details_batch',			title : '批次',				width : 115} ,
						{field : 'inventory_details_quantity',		title : '库存数量',			width : 151}
					] ]
		  		});
		   	});
		   
		 	//已过期
			$(".hosdnullMonth").click(function(){
	    	 	var dada=1;
		 		$("#destruction-drug").datagrid({
				    url:'select-drugs',
				    pagination:true,
				    pageNumber:1,
				    pageSize:10,
				    pageList:[10,20],
				    queryParams : {
						dada : dada
					},
				    columns : [ [ 
						{field : 'code',							title : '编号',				width : 40,checkbox:true}, 
						{field : 'inventory_number',				title : '库存编号',			width : 160,hidden:true}, 
						{field : 'inventory_details_number',		title : '药品库存编号',		width : 150}, 
						{field : 'drug_name',						title : '药品名称',			width : 160}, 
						{field : 'drug_standard',					title : '规格',				width : 150}, 
						{field : 'inventory_details_usedate',		title : '有效期',			width : 153,formatter:comFormatDate}, 
						{field : 'drug_purchase_price',				title : '单价',				width : 130}, 
						{field : 'inventory_details_batch',			title : '批次',				width : 115} ,
						{field : 'inventory_details_quantity',		title : '库存数量',			width : 151}
					] ]
				});
		   	});
		 	
			//未过期
			$(".hosdallMonth").click(function(){
	    	 	var dddd=1;
		 		$("#destruction-drug").datagrid({
				    url:'select-drugs',
				    pagination:true,
				    pageNumber:1,
				    pageSize:10,
				    pageList:[10,20],
				    queryParams : {
						dddd : dddd
					},
				    columns : [ [ 
						{field : 'code',							title : '编号',				width : 40,checkbox:true}, 
						{field : 'inventory_number',				title : '库存编号',			width : 160,hidden:true}, 
						{field : 'inventory_details_number',		title : '药品库存编号',		width : 150}, 
						{field : 'drug_name',						title : '药品名称',			width : 160}, 
						{field : 'drug_standard',					title : '规格',				width : 150}, 
						{field : 'inventory_details_usedate',		title : '有效期',			width : 153,formatter:comFormatDate}, 
						{field : 'drug_purchase_price',				title : '单价',				width : 130}, 
						{field : 'inventory_details_batch',			title : '批次',				width : 115} ,
						{field : 'inventory_details_quantity',		title : '库存数量',			width : 151}
					] ]
				});
		   });
			

		});
		
		
		$.extend($.fn.datagrid.methods, {
			editCell: function(jq,param){
				return jq.each(function(){
					var opts = $(this).datagrid('options');
					var fields = $(this).datagrid('getColumnFields',true).concat($(this).datagrid('getColumnFields'));
					for(var i=0; i<fields.length; i++){
						var col = $(this).datagrid('getColumnOption', fields[i]);
						col.editor1 = col.editor;
						if (fields[i] != param.field){
							col.editor = null;
						}
					}
					$(this).datagrid('beginEdit', param.index);
					for(var i=0; i<fields.length; i++){
						var col = $(this).datagrid('getColumnOption', fields[i]);
						col.editor = col.editor1;
					}
				});
			}
		});
		
		
		var editIndex = undefined;
		//采购编辑数量
		function endEditing2(){
			if (editIndex == undefined){return true}
			if ($('#purchase-dg').datagrid('validateRow', editIndex)){
				$('#purchase-dg').datagrid('endEdit', editIndex);
				editIndex = undefined;
				return true;
			} else {
				return false;
			}
		}
		function onClickCellb(index, field){//下面表格里要有这个点击
			if (endEditing2()){
				$('#purchase-dg').datagrid('selectRow', index)
						.datagrid('editCell', {index:index,field:field});
				editIndex = index;
			}
		}
		
		//退药编辑数量
		function endEditing(){
			if (editIndex == undefined){return true}
			if ($('#returnwin').datagrid('validateRow', editIndex)){
				$('#returnwin').datagrid('endEdit', editIndex);
				editIndex = undefined;
				return true;
			} else {
				return false;
			}
		}
		function onClickCell(index, field){//下面表格里要有这个点击
			if (endEditing()){
				$('#returnwin').datagrid('selectRow', index)
						.datagrid('editCell', {index:index,field:field});
				editIndex = index;
			}
		}
		
		//销毁编辑数量
		function endEditing1(){
			if (editIndex == undefined){return true}
			if ($('#destructionwin').datagrid('validateRow', editIndex)){
				$('#destructionwin').datagrid('endEdit', editIndex);
				editIndex = undefined;
				return true;
			} else {
				return false;
			}
		}
		function onClickCella(index, field){//下面表格里要有这个点击
			if (endEditing1()){
				$('#destructionwin').datagrid('selectRow', index)
						.datagrid('editCell', {index:index,field:field});
				editIndex = index;
			}
		}
		
		//格式化时间
		function comFormatDate(date) {
			var day = new Date(date); 
			var Year = 0; 
			var Month = 0; 
			var Day = 0; 
			var CurrentDate = ""; 
			//初始化时间 
			Year= day.getFullYear();//ie火狐下都可以 
			Month= day.getMonth()+1; 
			Day = day.getDate(); 
			CurrentDate += Year + "-"; 
			if (Month >= 10 ) { 
				CurrentDate += Month + "-"; 
			}else { 
				CurrentDate += "0" + Month + "-"; 
			} 
			if (Day >= 10 ) { 
				CurrentDate += Day ; 
			}else { 
				CurrentDate += "0" + Day ; 
			} 
			return CurrentDate; 
		}
		


		
	</script>
	
	<div id="tt" class="easyui-tabs" style="width:100%;height:100%">
	
	    <div title="药品采购" style="padding:20px;display:none;">
			<fieldset style="border: 1px solid #A6A6A6; border-radius: 6px; width: 1050px; margin: 0 auto;">
				<input  type="hidden" class="easyui-textbox" id="gongys"> 
			
				<legend style="font-size: 17px">药品采购</legend>
				
				<div style="padding: 10px">
				
					<table id="purchase-dg" class="logininform-table easyui-datagrid" style="width: 1050px; height: 308px"
						data-options="toolbar:'#logininform-tb',fitColumns:false,singleSelect:false,onClickCell: onClickCellb">
					
					</table>
					
					<p style="margin-left: 200px;">
						
						<a id="save-purchase" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-ok">确认采购</a> 
						
						<span style="margin-left: 80px;"></span>
						
						<a id="cancel-oldpurchase" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-ok">药品添加</a>
						
						<span style="margin-left:80px;"></span>
						
						<a id="delete-purchase" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-cancel">删除</a>
						
						<span style="margin-left:80px;"></span>
						
						<a id="delete-kong" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-cancel">清空</a>
					
					</p>
					
				</div>
		
		</fieldset>
	
	    </div>
	   
	    <div title="药品退药" style="overflow:auto;padding:20px;display:none;">
						
			<fieldset style="border: 1px solid #A6A6A6; border-radius: 6px; width: 1050px; margin: 0 auto;">
				<input  type="hidden" class="easyui-textbox" id="gongty">
				
				<legend style="font-size: 17px">药品退药</legend>
				
					<div style="padding: 10px">
						
						<table id="returnwin" class="logininform-table easyui-datagrid" style="width: 1050px; height: 308px"
							data-options="toolbar:'#logininform-tb',fitColumns:false,singleSelect:false,onClickCell: onClickCell">
	
						</table>
					
					</div>
					
					<span style="margin-left: 20px;"></span>
					 
					<input id="returndrug-jiek" class="easyui-textbox" style="width: 1030px;" data-options="label:'退药原因：'"></input>
					
					<p style="margin-left: 200px;">
						
						<a id="que-returndrug" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-ok" style="width: 130px;">确认</a> 
						
						<span style="margin-left: 80px;"></span> 
						
						<a id="checkdrug-ann" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-ok" style="width: 100px;">选择药品</a>
						
						<span style="margin-left: 80px;"></span> 
						
						<a id="deletedrug-ann" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-cancel" style="width: 100px;">删除</a>
						
						<span style="margin-left: 80px;"></span>
						
						<a id="delete-qkong" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-cancel">清空</a>
					</p>
					
				</fieldset>
					   
	    </div>
	    
	    <div title="药品销毁" style="padding:20px;display:none;">
			
			<fieldset style="border: 1px solid #A6A6A6; border-radius: 6px; width: 1050px; margin: 0 auto;">
			
				<input  type="hidden" class="easyui-textbox" id="gongxh">
				
				<legend style="font-size: 17px">药品销毁</legend>
					<div style="padding: 10px">
						
						<table id="destructionwin" class="logininform-table easyui-datagrid" style="width: 1050px; height: 308px"
							data-options="toolbar:'#logininform-tb',fitColumns:false,singleSelect:false,onClickCell: onClickCella">
	
						</table>
					
					</div>
					
					<span style="margin-left: 20px;"></span>
					 
					<input id="destruction-ysy" class="easyui-textbox" style="width: 1030px;" data-options="label:'销毁原因：'"></input>
					
					<p style="margin-left: 200px;">
						
						<a id="destruc-drug" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-ok" style="width: 130px;">确认</a> 
						
						<span style="margin-left: 80px;"></span> 
						
						<a id="destruction-ann" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-ok" style="width: 100px;">选择药品</a>
						
						<span style="margin-left: 80px;"></span> 
						
						<a id="destructiondele" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-cancel" style="width: 100px;">删除</a>
						
						<span style="margin-left:80px;"></span>
						
						<a id="delete-qkonga" style="width: 100px;" class="easyui-linkbutton" iconCls="icon-cancel">清空</a>
					</p>
				</fieldset>
				
	    </div>
	
	</div>
	
	<!-- 销毁药品窗口 -->
	<div id="destruction-win" class="easyui-window" title="销毁药品添加" style="width: 1090px; height: 500px"
		data-options="iconCls:'icon-save',modal:true,closed:true,shadow:true,resizable:false,collapsible:false,minimizable:false,maximizable:false">
		
		<div class="easyui-layout" data-options="fit:true">
			
			<div data-options="region:'center'">
				
				<div style="padding: 10px">
					
					<p style="height: 20px; line-height: 20px; margin-right: 20px;float:right; padding: 10px">
						
						<a style=" width: 90px;  display: inline-block;">
							<span style="display: inline-block; width: 20px; height: 20px; float: left;">
								<input style="margin-top: 5px;" type="radio" name="radionames" class="hosdallMonth">
							</span> 
							<span style="margin-left: 4px;">未过期</span>
						</a> 
						
						<a style=" width: 90px;  display: inline-block;">
							<span style="display: inline-block; width: 20px; height: 20px; float: left;">
								<input style="margin-top: 5px;" type="radio" name="radionames" class="hosdnullMonth">
							</span> 
							<span style="margin-left: 4px;">已过期</span>
						</a> 
						
					</p>
			
					<table id="destruction-drug" class="logininform-table easyui-datagrid" style="width: 1050px; height: 308px"
						data-options="toolbar:'#logininform-tb',fitColumns:false,singleSelect:false">
					
					</table>

					<p style="margin-right: 40px; float: right; padding: 10px">
						
						<a id="save-destruction" class="easyui-linkbutton" iconCls="icon-ok">一键添加</a>
						
					</p>

				</div>
				
			</div>
			
		</div>
		
	</div>
		
	<!-- 退药药品窗口 -->
	<div id="tuidrug-win" class="easyui-window" title="退药药品添加" style="width: 1080px; height: 550px"
		data-options="iconCls:'icon-save',modal:true,closed:true,shadow:true,resizable:false,collapsible:false,minimizable:false,maximizable:false">
		
		<div class="easyui-layout" data-options="fit:true">
			
			<div data-options="region:'center'">
				
				<div style="width: 1050px;height:60px;">
				
					<p style="height: 20px; line-height: 20px; margin-right: 20px;float:right; padding: 10px">
						<a style=" width: 131px;  display: inline-block;">
							<span style="display: inline-block; width: 20px; height: 20px; float: left;">
								<input style="margin-top: 5px;" type="radio" name="radionames" class="hosOMonth">
							</span> 
							<span style="margin-left: 4px;">有效期临近一个月</span>
						</a> 
						
						<a style="margin-right: 20px; width: 131px; height: 26px; display: inline-block;">
							<span style="display: inline-block; width: 20px; height: 20px; float: left;">
								<input style="margin-top: 5px;" type="radio" name="radionames" class="hosTMonth">
							</span> 
							<span style="margin-left: 4px;">有效期临近三个月</span>
						</a>
					
						<select id="bingbox" class="easyui-combobox" data-options="label:'供应商：',required:false"  style="width: 200px;" >
						</select>
					</p>

				
				</div>
				
				<div style="padding: 10px">
					
					<table id="returndrug" class="logininform-table easyui-datagrid" style="width: 1040px; height: 308px"
						data-options="toolbar:'#logininform-tb',fitColumns:false,singleSelect:false">
					
					</table>

					<p style="margin-right: 50px; float: right; padding: 10px">
						
						<a id="save-tuidrug" class="easyui-linkbutton" iconCls="icon-ok">一键添加</a>
						
					</p>

				</div>
				
			</div>
			
		</div>
		
	</div>

	<!-- 老药品窗口 -->
	<div id="oldpurchase-win" class="easyui-window" title="老药品添加" style="width: 1080px; height: 550px"
		data-options="iconCls:'icon-save',modal:true,closed:true,shadow:true,resizable:false,collapsible:false,minimizable:false,maximizable:false">
		
		<div class="easyui-layout" data-options="fit:true">
			
			<div data-options="region:'center'">
				
				<div style="width: 1050px;height:60px;">
				
					<p style="height: 30px; line-height: 20px; margin-right: 20px;float:right; padding: 10px">
					
						<select id="gys-state" class="easyui-combobox" data-options="label:'供应商：',required:false"  style="width: 200px;" >
						</select>
					</p>
				
				</div>
				
				
				<div style="padding: 10px">
					
					<table id="oldpurchase-dg" class="logininform-table easyui-datagrid" style="width: 1040px; height: 308px"
						data-options="toolbar:'#logininform-tb',fitColumns:false,singleSelect:false">
					
					</table>

					<p style="margin-right: 50px; float: right;padding: 10px">
						
						<a id="save-oldpurchase" class="easyui-linkbutton" iconCls="icon-ok">一键添加</a>
						
					</p>

				</div>
				
			</div>
			
		</div>
		
	</div>

	<!-- 新药品窗口 -->
	<div id="newpurchase-win" class="easyui-window" title="新药品添加" style="width: 590px; height: 450px"
		data-options="iconCls:'icon-save',closed:true,modal:true,shadow:true,resizable:false,collapsible:false,minimizable:false,maximizable:false">
		
		<div class="easyui-layout" data-options="fit:true">
			
			<div data-options="region:'center'" style="padding: 30px;">
				
				<p style="height: 60px; line-height: 20px;">
					
					<input id="purchase-ypmc" class="easyui-textbox" style="width: 200px" data-options="label:'药品名称：'"></input>
					
					<span style="margin-left: 50px;"></span> 
					
					<input id="purchase-ypgg" class="easyui-textbox" style="width: 200px" data-options="label:'药品规格：'"></input>
				
				</p>
				
				<p style="height: 60px; line-height: 20px;">
					
					<input id="purchase-ypdw" class="easyui-textbox" style="width: 200px" data-options="label:'单位：'"></input> 
					
					<span style="margin-left: 50px;"></span>
					
					<input id="purchase-bzq" class="easyui-textbox" style="width: 200px" data-options="label:'保质期：'"></input>
				</p>
				
				<p style="height: 60px; line-height: 20px;">
					
					<select class="easyui-combobox" data-options="label:'类别：'" name="drug-LB" style="width: 200px;">
						<option value="ZY">中药</option>
						<option value="XY">西药</option>
					</select>
					
					<span style="margin-left: 50px;"></span> 
					
					<select class="easyui-combobox" data-options="label:'类型：'" name="drug-state" style="width: 200px;">
						<option value="AL">感冒类</option>
						<option value="AK">儿科用药</option>
						<option value="AZ">皮肤外用药</option>
						<option value="AR">注射剂</option>
					</select>
				
				</p>
				
				<p style="margin-left: 130px;">
					
					<a id="save-newpurchase" class="easyui-linkbutton" iconCls="icon-ok">添加</a> 
					
					<span style="margin-left: 50px;"></span>
					
					<a id="cancel-newpurchase" class="easyui-linkbutton" iconCls="icon-cancel">取消</a>
				
				</p>
			
			</div>
		
		</div>
	
	</div>
	
	<input type="hidden" value="${user.userName}"  id="indentPeople"> 
	
	<!-- 弹框提示 -->
	<div id="DRUGONE" class="easyui-window"  title="提示框" style="width:300px;height:156px"
	    data-options="iconCls:'icon-save',modal:true,resizable:false,collapsible:false,maximizable:false,minimizable:false,closed:true">
	          <p class="drugone" style="text-align:center;font-size: 16px;margin-top: 47px;">
	          </p>
	</div>
	<div id="DRUGONEf" class="easyui-window"  title="提示框" style="width:300px;height:156px"
	    data-options="iconCls:'icon-save',modal:true,resizable:false,collapsible:false,maximizable:false,minimizable:false,closed:true">
	          <p class="drugonef" style="text-align:center;font-size: 16px;margin-top: 47px;">
	          </p>
	</div>

</body>
</html>